const router = require('express').Router();

const userService = require('../services/user.js');

router.post('/register', async (req, res) => {
  const result = await userService.registerNewUser(req.body)
  res.send('注册成功')
})

router.post('/login', async (req, res) => {
  const { username, password } = req.body
  const result = await userService.checkLoginInfo(username, password);
  res.send(result)
})

module.exports = router;